home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / os2 / listea.arj / LISTEA.CMD next >
OS/2 REXX Batch file  |  1994-01-31  |  58KB  |  859 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*           LISTEA.CMD - Version 1.0 - Version Date 1994-01-29           */
  4. /*                Copyright (C) 1994 by C F S Nevada, Inc.                */
  5. /*                                                                        */
  6. /*                 by Dick Goran  - Voice   702-732-9616                  */
  7. /*                                - FAX     702-732-3847                  */
  8. /*                                - CIS     72200,347                     */
  9. /*                                - FIDO    1:209/705                     */
  10. /*                                - IBMLink DEV4672                       */
  11. /*                                                                        */
  12. /*------------------------------------------------------------------------*/
  13. /*  The windowing functions, including RXWIN30.DLL, along with REXXLIB    */
  14. /*    are the property of, and are used with the permission of their      */
  15. /*     owner - Quercus Systems, P.O. Box 2157, Saratoga, Ca. 95070.       */
  16. /*         Voice 408-867-7399, BBS 408-867-7488, CIS 75300,2450           */
  17. /*------------------------------------------------------------------------*/
  18. /*
  19.      This program will build a file, LISTEA.TXT, in the same directory
  20.      where this program resides. This file will contain a text listing
  21.      of all of the Extended Attributes (in both hex and character
  22.      notation) for all directories and files in the object system
  23.      except that REXX metafiles are not detailed and non-local drives
  24.      are ignored.
  25.  
  26.      Two temporary work files, SYS001 and SYS002, area created in the
  27.      same directory where LISTEA.CMD resides while the program is
  28.      running. They are erased on completion.
  29.  
  30.      This program may take a considerable amount of time to run
  31.      depending on the speed of the system and the number of files to
  32.      be processed.
  33.  
  34.      The file created by this program, LISTEA.TXT, will be large (2 MB
  35.      - 3 MB) and can be viewed with any viewer or ASCII editor capable
  36.      of handling large files.
  37.  
  38.      An index list of the EA names encountered is included at the end
  39.      of LISTEA.TXT with the name of a file which contains this EA.
  40.      Also, the number of times that that EA type occurs in the system
  41.      is indicated.
  42.  
  43. Updates:
  44.          94/01/12 - Eliminate non LOCAL drives
  45.          94/01/21 - Minor changes
  46. */
  47.                                                                   /* 0047 */
  48. parse Version  REXX_Version .                                     /* 0048 */
  49. parse Source   OS_Name  Calling_Environment  program_path_and_name
  50. OS_Environment = 'OS2ENVIRONMENT'                                 /* 0050 */
  51. program_name = FileSpec( 'N', program_path_and_name )             /* 0051 */
  52. program_path = LEFT( program_path_and_name, LENGTH(program_path_and_name) -,
  53.                                             LENGTH(program_name) )
  54. program_version = 1.0               /* program version / mod level */
  55. say 'Begin' program_name 'at' TIME('N')                           /* 0055 */
  56. elapsed_time = TIME('E')            /* get elapsed time - sssss.uuuuu     */
  57. call REGISTER_REQUIRED_FUNCTIONS    /* register DLLs if needed            */
  58.                                                                   /* 0058 */
  59.    SIGNAL ON ERROR                  /* trap object time errors     */
  60. /* SIGNAL ON HALT */                /* trap object time errors     */
  61.    SIGNAL ON NOVALUE                /* trap object time errors     */
  62.    SIGNAL ON SYNTAX                 /* trap object time errors     */
  63.    !signal_value = 0                /* used to determine the above */
  64.                                                                   /* 0064 */
  65. /*----------------------------*/                                  /* 0065 */
  66. /* Define output & work files */                                  /* 0066 */
  67. /*----------------------------*/                                  /* 0067 */
  68. output_file  = program_path || 'LISTEA.TXT'                       /* 0068 */
  69. output_disk = FILESPEC( 'D', output_file )                        /* 0069 */
  70. call SysFileDelete output_file                                    /* 0070 */
  71. output_file_line_count = 0                                        /* 0071 */
  72. free_space = DOSDISK( 'F', output_disk )                          /* 0072 */
  73. if free_space < (2 * 1024 * 1024) then                            /* 0073 */
  74.    do                                                             /* 0074 */
  75.       call LINEOUT 'CON:',,                                       /* 0075 */
  76.          'WARNING! There may not be adequate free space on drive ' ||,
  77.          UPPER(output_disk) || '.'                                /* 0077 */
  78.       call LINEOUT 'CON:',,                                       /* 0078 */
  79.          '         However, program will continue.'               /* 0079 */
  80.    end                                                            /* 0080 */
  81.                                                                   /* 0081 */
  82. SYS001 = program_path || 'LISTEA.SY1' /* directory lines                  */
  83. SYS002 = program_path || 'LISTEA.SY2' /* ea file size & full name         */
  84.                                                                   /* 0084 */
  85. /*-------------------------------*/                               /* 0085 */
  86. /* Table & constant declarations */                               /* 0086 */
  87. /*-------------------------------*/                               /* 0087 */
  88. call INITIALIZE                     /* setup tables & constants           */
  89. ea_max_length = 0                   /* length of longest name             */
  90.                                                                   /* 0090 */
  91. /* signal PROCESS_SYS002 */ /* for test use only */               /* 0091 */
  92.                                                                   /* 0092 */
  93. /*------------------------------------*/                          /* 0093 */
  94. /* Put EA file size & names in SYS002 */                          /* 0094 */
  95. /*------------------------------------*/                          /* 0095 */
  96. say 'Sorting directory & file names'                              /* 0096 */
  97. call SysFileDelete SYS002                                         /* 0097 */
  98. do w = 1 to WORDS(drive_table)                                    /* 0098 */
  99.    call PROCESS_DRIVE  WORD( drive_table, w )                     /* 0099 */
  100. end                                                               /* 0100 */
  101. call STREAM SYS002, 'C', 'CLOSE'                                  /* 0101 */
  102.                                                                   /* 0102 */
  103. /*---------------------------------------*/                       /* 0103 */
  104. /* Sort and write all EAs to output file */                       /* 0104 */
  105. /*---------------------------------------*/                       /* 0105 */
  106. PROCESS_SYS002:                                                   /* 0106 */
  107. file_table. = ''                      /* initialize array */      /* 0107 */
  108. file_table_max_length = 0                                         /* 0108 */
  109. e = 0                                                             /* 0109 */
  110. do while LINES(SYS002) > 0                                        /* 0110 */
  111.    e = e + 1                                                      /* 0111 */
  112.    input_line = LINEIN(SYS002)                                    /* 0112 */
  113.    file_table.e = input_line                                      /* 0113 */
  114.    file_table_max_length = MAX( file_table_max_length,,           /* 0114 */
  115.                                 LENGTH( WORD( input_line, 2 ) ) ) /* 0115 */
  116. end                                                               /* 0116 */
  117. call STREAM SYS002, 'C', 'CLOSE'                                  /* 0117 */
  118.                                                                   /* 0118 */
  119. file_table.0 = e                                                  /* 0119 */
  120. call ARRAYSORT 'file_table', 1, file_table.0,,                    /* 0120 */
  121.                                 10, file_table_max_length         /* 0121 */
  122.                                                                   /* 0122 */
  123. call CHAROUT 'CON:', 'Building ' ||,                              /* 0123 */
  124.                      output_file ||,                              /* 0124 */
  125.                      COPIES( ' ', 2 )                             /* 0125 */
  126. bksp = '08'x                                                      /* 0126 */
  127. progress_list = '─\|/'                                            /* 0127 */
  128. progress_subscript = 1                                            /* 0128 */
  129. do e = 1 to file_table.0                                          /* 0129 */
  130.    call FORMAT_EA_ITEM file_table.e                               /* 0130 */
  131.    call CHAROUT 'CON:', bksp ||,                                  /* 0131 */
  132.                        SUBSTR( progress_list, progress_subscript, 1 )
  133.    progress_subscript = progress_subscript + 1                    /* 0133 */
  134.    if progress_subscript > LENGTH(progress_list) then             /* 0134 */
  135.       progress_subscript = 1                                      /* 0135 */
  136. end                                                               /* 0136 */
  137. call LINEOUT 'CON:', bksp || ' '                                  /* 0137 */
  138.                                                                   /* 0138 */
  139. /*--------------------------------------*/                        /* 0139 */
  140. /* Write sorted EA index to output file */                        /* 0140 */
  141. /*--------------------------------------*/                        /* 0141 */
  142. call LINEOUT output_file,  heading.2 ||,                          /* 0142 */
  143.                            '0D0A'x                                /* 0143 */
  144.                                                                   /* 0144 */
  145. output_line = LEFT( 'EA Name', 22 ) ||,                           /* 0145 */
  146.               LEFT( 'Type',     8 ) ||,                           /* 0146 */
  147.               LEFT( 'Ct.',      7 ) ||,                           /* 0147 */
  148.               'Example'                                           /* 0148 */
  149. call LINEOUT output_file, output_line                             /* 0149 */
  150.                                                                   /* 0150 */
  151. output_line = COPIES( '-', 19 ) ||,                               /* 0151 */
  152.               COPIES( ' ',  3 ) ||,                               /* 0152 */
  153.               COPIES( '-',  4 ) ||,                               /* 0153 */
  154.               COPIES( ' ',  4 ) ||,                               /* 0154 */
  155.               COPIES( '-',  4 ) ||,                               /* 0155 */
  156.               COPIES( ' ',  3 ) ||,                               /* 0156 */
  157.               COPIES( '-', 39 )                                   /* 0157 */
  158. call LINEOUT output_file, output_line                             /* 0158 */
  159.                                                                   /* 0159 */
  160. call ARRAYSORT 'ea_table', 1, ea_table.0                          /* 0160 */
  161. do i = 1 to ea_table.0                                            /* 0161 */
  162.    parse value ea_table.i with ea_name ea_hex_value ea_example    /* 0162 */
  163.    output_line = LEFT( ea_name, 22) ||,                           /* 0163 */
  164.                  C2X( ea_hex_value ) ||,                          /* 0164 */
  165.                  COPIES( ' ', 3 ) ||,                             /* 0165 */
  166.                  FORMAT( ea_table.ea_name, 5 ) ||,                /* 0166 */
  167.                  COPIES( ' ', 3 ) ||,                             /* 0167 */
  168.                  ea_example                                       /* 0168 */
  169.    call WRITE_OUTPUT_FILE output_line                             /* 0169 */
  170. end                                                               /* 0170 */
  171. call STREAM output_file, 'C', 'CLOSE'                             /* 0171 */
  172.                                                                   /* 0172 */
  173. call SysFileDelete SYS001           /* erase work files                   */
  174. call SysFileDelete SYS002                                         /* 0174 */
  175.                                                                   /* 0175 */
  176. call EOJ 0                                                        /* 0176 */
  177.                                                                   /* 0177 */
  178. !tr!=VALUE('TRACE',,'OS2Environment'); if !tr!<>'' then do;TRACE(!tr!);nop;end
  179. /*#-----------------------------------------------------------------------*/
  180. /*                                                                        */
  181. /*                               End of Job                               */
  182. /*                                                                        */
  183. /*------------------------------------------------------------------------*/
  184. EOJ:                                                              /* 0184 */
  185.    Procedure expose program_name                                  /* 0185 */
  186.                                                                   /* 0186 */
  187. if ARG() = 0 then                                                 /* 0187 */
  188.    eoj_rc = 0                                                     /* 0188 */
  189. else                                                              /* 0189 */
  190.    eoj_rc = ARG(1)                                                /* 0190 */
  191. elapsed_time = TIME('E')            /* get elapsed time - sssss.uuuuu     */
  192. parse value elapsed_time with seconds '.' micro_seconds           /* 0192 */
  193. if SUBSTR(micro_seconds, 1, 1) >= 5 then                          /* 0193 */
  194.    seconds = seconds + 1                                          /* 0194 */
  195. ss = FORMAT(seconds // 60, 2)                                     /* 0195 */
  196. minutes = (seconds - ss) / 60                                     /* 0196 */
  197. mm = FORMAT(minutes // 60, 2)                                     /* 0197 */
  198. hh = FORMAT((minutes - mm) / 60, 2)                               /* 0198 */
  199. duration = hh':'mm':'ss                                           /* 0199 */
  200. say 'EOJ  ' program_name 'at' TIME('N') ||,                       /* 0200 */
  201.     ', duration' TRANSLATE(duration, '0', ' ')                    /* 0201 */
  202. exit eoj_rc                                                       /* 0202 */
  203.                                                                   /* 0203 */
  204.                                                                   /* 0204 */
  205. /*#-----------------------------------------------------------------------*/
  206. /*                                                                        */
  207. /*         Get each EA and write to output file & build EA matrix         */
  208. /*                                                                        */
  209. /*------------------------------------------------------------------------*/
  210. FORMAT_EA_ITEM:                                                   /* 0210 */
  211.    Procedure expose,                                              /* 0211 */
  212.       ea_max_length,                                              /* 0212 */
  213.       ea_table.,                                                  /* 0213 */
  214.       program_name,                                               /* 0214 */
  215.       output_file,                                                /* 0215 */
  216.       output_file_line_count,                                     /* 0216 */
  217.       contig_hex_tt,                                              /* 0217 */
  218.       spread_hex_tt,                                              /* 0218 */
  219.       SYS001 SYS002,                                              /* 0219 */
  220.       tt_128                                                      /* 0220 */
  221.                                                                   /* 0221 */
  222. parse arg file_size file_name                                     /* 0222 */
  223. file_name = STRIP(file_name)                                      /* 0223 */
  224. crlf = '0D0A'x                                                    /* 0224 */
  225.                                                                   /* 0225 */
  226. ea_count = DOSEALIST( file_name, 'name_stem', 'value_stem', 'flag_stem' )
  227. if ea_count ¬> 0 then                                             /* 0227 */
  228.    do                                                             /* 0228 */
  229.       say '0D0A'x || 'DOSEALIST unexpected return code of ' ||,   /* 0229 */
  230.           ea_count                                                /* 0230 */
  231.       say '   for' file_name                                      /* 0231 */
  232.       say '   Data for above file will not appear in ' ||,        /* 0232 */
  233.           FILESPEC( 'N', output_file )                            /* 0233 */
  234.       return                                                      /* 0234 */
  235.    end                                                            /* 0235 */
  236.                                                                   /* 0236 */
  237. do i = 1 to name_stem.0                                           /* 0237 */
  238.    name = STRIP( name_stem.i, 'L', '.' )                          /* 0238 */
  239.                                                                   /* 0239 */
  240.    /*------------------------*/                                   /* 0240 */
  241.    /* Write Formatted output */                                   /* 0241 */
  242.    /*------------------------*/                                   /* 0242 */
  243.    output_line = file_name                                        /* 0243 */
  244.    if file_size = '<DIR>' then                                    /* 0244 */
  245.       do                                                          /* 0245 */
  246.          output_line = output_line || ' <DIR>'                    /* 0246 */
  247.       end                                                         /* 0247 */
  248.                                                                   /* 0248 */
  249.    list_name_only = 0                                             /* 0249 */
  250.    if ( LEFT( name, 5 ) = 'REXX.' ) |,                            /* 0250 */
  251.          ( name = 'ICON' ) then                                   /* 0251 */
  252.       do                                                          /* 0252 */
  253.          list_name_only = 1                                       /* 0253 */
  254.       end                                                         /* 0254 */
  255.                                                                   /* 0255 */
  256.    if list_name_only = 1 then                                     /* 0256 */
  257.       if i = 1 then                                               /* 0257 */
  258.          do                                                       /* 0258 */
  259.             if output_file_line_count > 0 then                    /* 0259 */
  260.                output_line = crlf || output_line /* preceed with blank line */
  261.             call WRITE_OUTPUT_FILE output_line                    /* 0261 */
  262.          end                                                      /* 0262 */
  263.       else                                                        /* 0263 */
  264.          nop                                                      /* 0264 */
  265.    else                                                           /* 0265 */
  266.       do                                                          /* 0266 */
  267.          if output_file_line_count > 0 then                       /* 0267 */
  268.             output_line = crlf || output_line /* preceed with blank line */
  269.          call WRITE_OUTPUT_FILE output_line                       /* 0269 */
  270.       end                                                         /* 0270 */
  271.                                                                   /* 0271 */
  272.    output_line = COPIES( ' ', 3 ) ||,                             /* 0272 */
  273.                  LEFT( 'Flag = ''' || C2X(flag_stem.i) || '''x', 15) ||,
  274.                  'Name = ' ||,                                    /* 0274 */
  275.                  LEFT( name_stem.i, 35 ) ||,                      /* 0275 */
  276.                  'Length = ''' ||,                                /* 0276 */
  277.                  D2X( LENGTH(value_stem.i), 4 ) ||,               /* 0277 */
  278.                  '''x'                                            /* 0278 */
  279.    call WRITE_OUTPUT_FILE output_line                             /* 0279 */
  280.                                                                   /* 0280 */
  281.    if list_name_only = 0 then                                     /* 0281 */
  282.       do                                                          /* 0282 */
  283.          call FORMAT_EA_DETAIL  value_stem.i                      /* 0283 */
  284.       end                                                         /* 0284 */
  285.                                                                   /* 0285 */
  286.    /*---------------------------------*/                          /* 0286 */
  287.    /* Cross index EA name in EA table */                          /* 0287 */
  288.    /*---------------------------------*/                          /* 0288 */
  289.    if ea_table.name = '' then                                     /* 0289 */
  290.       do                                                          /* 0290 */
  291.          e = ea_table.0 + 1                                       /* 0291 */
  292.          ea_table.0 = e                                           /* 0292 */
  293.          ea_table.e = name,                                       /* 0293 */
  294.                       SUBSTR( value_stem.i, 2, 1 ) ||,            /* 0294 */
  295.                       SUBSTR( value_stem.i, 1, 1 ),               /* 0295 */
  296.                       file_name                                   /* 0296 */
  297.          ea_table.name = 1                                        /* 0297 */
  298.          if LENGTH(name) > ea_max_length then                     /* 0298 */
  299.             ea_max_length = LENGTH(name)                          /* 0299 */
  300.       end                                                         /* 0300 */
  301.    else                                                           /* 0301 */
  302.       do                                                          /* 0302 */
  303.          ea_table.name = ea_table.name + 1                        /* 0303 */
  304.       end                                                         /* 0304 */
  305.                                                                   /* 0305 */
  306. end                                                               /* 0306 */
  307.                                                                   /* 0307 */
  308. return                                                            /* 0308 */
  309.                                                                   /* 0309 */
  310. /*------------------------------------------------------------------------*/
  311. /*                                                                        */
  312. /*                    Format hex & character EA detail                    */
  313. /*                                                                        */
  314. /*------------------------------------------------------------------------*/
  315. FORMAT_EA_DETAIL:                                                 /* 0315 */
  316.    Procedure expose,                                              /* 0316 */
  317.       output_file,                                                /* 0317 */
  318.       output_file_line_count,                                     /* 0318 */
  319.       program_name,                                               /* 0319 */
  320.       contig_hex_tt,                                              /* 0320 */
  321.       spread_hex_tt,                                              /* 0321 */
  322.       SYS001 SYS002,                                              /* 0322 */
  323.       tt_128                                                      /* 0323 */
  324.                                                                   /* 0324 */
  325. ea_data               = ARG(1)                                    /* 0325 */
  326. hex_displacement      = 0                                         /* 0326 */
  327. prev_character_string = ''                                        /* 0327 */
  328. sameness_switch        = 0                                        /* 0328 */
  329.                                                                   /* 0329 */
  330. do until ea_data = ''                                             /* 0330 */
  331.    parse value ea_data with leading_token 17 ea_data              /* 0331 */
  332.                                                                   /* 0332 */
  333.    temp_character_string = LEFT( leading_token, 16 )              /* 0333 */
  334.    if temp_character_string <> prev_character_string then         /* 0334 */
  335.       do                                                          /* 0335 */
  336.          temp_hex_string = TRANSLATE( spread_hex_tt,,             /* 0336 */
  337.                                       C2X(temp_character_string),,
  338.                                       contig_hex_tt )             /* 0338 */
  339.          word_count = ( LENGTH(leading_token) - 1 ) % 4           /* 0339 */
  340.          byte_count = LENGTH(leading_token) - ( 4 * word_count )  /* 0340 */
  341.          temp_hex_length = ( 9 * word_count ) + ( 2 * byte_count )
  342.          output_line = COPIES( ' ', 10 ) ||,                      /* 0342 */
  343.                        '+' || D2X( hex_displacement, 4 ) ||,      /* 0343 */
  344.                        COPIES( ' ', 3 ) ||,                       /* 0344 */
  345.                        '| ' ||,                                   /* 0345 */
  346.                        LEFT( temp_hex_string, temp_hex_length ) ||,
  347.                        COPIES( ' ', 35 - temp_hex_length ) ||,    /* 0347 */
  348.                        ' |' ||,                                   /* 0348 */
  349.                        COPIES( ' ', 3 ) ||,                       /* 0349 */
  350.                        TRANSLATE( temp_character_string, tt_128 ) /* 0350 */
  351.          call WRITE_OUTPUT_FILE output_line                       /* 0351 */
  352.          sameness_switch = 0                                      /* 0352 */
  353.       end                                                         /* 0353 */
  354.    else                                                           /* 0354 */
  355.       if sameness_switch = 0 then                                 /* 0355 */
  356.          do                                                       /* 0356 */
  357.             output_line = COPIES( ' ', 10 ) ||,                   /* 0357 */
  358.                           '+' || D2X( hex_displacement, 4 ) ||,   /* 0358 */
  359.                           COPIES( ' ', 3 ) ||,                    /* 0359 */
  360.                           '| ' ||,                                /* 0360 */
  361.                           LEFT( 'same', 35 ) ||,                  /* 0361 */
  362.                           ' |'                                    /* 0362 */
  363.             call WRITE_OUTPUT_FILE output_line                    /* 0363 */
  364.             sameness_switch = 1                                   /* 0364 */
  365.          end                                                      /* 0365 */
  366.                                                                   /* 0366 */
  367.    hex_displacement = hex_displacement + 16                       /* 0367 */
  368.    prev_character_string = temp_character_string                  /* 0368 */
  369. end                                                               /* 0369 */
  370. return                                                            /* 0370 */
  371.                                                                   /* 0371 */
  372. /*#-----------------------------------------------------------------------*/
  373. /*                                                                        */
  374. /*                      Initialize translate tables                       */
  375. /*                                                                        */
  376. /*------------------------------------------------------------------------*/
  377. INITIALIZE:                                                       /* 0377 */
  378.    Procedure expose,                                              /* 0378 */
  379.       contig_hex_tt,                                              /* 0379 */
  380.       drive_table,                                                /* 0380 */
  381.       ea_table.,                                                  /* 0381 */
  382.       heading.,                                                   /* 0382 */
  383.       hex_tt,                                                     /* 0383 */
  384.       program_name,                                               /* 0384 */
  385.       output_file,                                                /* 0385 */
  386.       spread_hex_tt,                                              /* 0386 */
  387.       tt_128,                                                     /* 0387 */
  388.       tt_256                                                      /* 0388 */
  389.                                                                   /* 0389 */
  390. drive_table  = SysDriveMap( 'C', 'LOCAL' )                        /* 0390 */
  391. ea_table.    = ''; ea_table.0   = 0                               /* 0391 */
  392. output_width = 76                                                 /* 0392 */
  393.                                                                   /* 0393 */
  394. title =,                                                          /* 0394 */
  395.          'Listing of EAs on Drives ' ||,                          /* 0395 */
  396.          STRIP(drive_table)                                       /* 0396 */
  397. heading.1 =,                                                      /* 0397 */
  398.          DATE('O') ||,                                            /* 0398 */
  399.          COPIES( ' ', 2 ) ||,                                     /* 0399 */
  400.          TIME('N') ||,                                            /* 0400 */
  401.          COPIES( ' ', 10 ) ||,                                    /* 0401 */
  402.          title                                                    /* 0402 */
  403.                                                                   /* 0403 */
  404. heading.2 =,                                                      /* 0404 */
  405.          '0C'x ||,                                                /* 0405 */
  406.          CENTER( 'EA Index List', output_width )                  /* 0406 */
  407.                                                                   /* 0407 */
  408. call LINEOUT output_file, heading.1 || '0D0A'x                    /* 0408 */
  409.                                                                   /* 0409 */
  410. hex_tt = COPIES( '00'x, 256 )                                     /* 0410 */
  411. hex_tt = OVERLAY( XRANGE('30'x, '39'x), hex_tt, X2D(30) + 1 ) /* 0 - 9    */
  412. hex_tt = OVERLAY( XRANGE('41'x, '46'x), hex_tt, X2D(41) + 1 ) /* A - F    */
  413. hex_tt = OVERLAY( XRANGE('41'x, '46'x), hex_tt, X2D(61) + 1 ) /* a - f    */
  414.                                                                   /* 0414 */
  415. /* used for hex display of data */                                /* 0415 */
  416. contig_hex_tt = XRANGE('01'x, '21'x)                              /* 0416 */
  417. spread_hex_tt = XRANGE('01'x, '08'x) || '21'x ||,                 /* 0417 */
  418.                 XRANGE('09'x, '10'x) || '21'x ||,                 /* 0418 */
  419.                 XRANGE('11'x, '18'x) || '21'x ||,                 /* 0419 */
  420.                 XRANGE('19'x, '20'x)                              /* 0420 */
  421.                                                                   /* 0421 */
  422. tt_128 = COPIES( '.', 32 ) || XRANGE('20'X, '7F'X) || COPIES( '.', 128 )
  423. tt_256 = '2E01 0203 0405 062E 2E2E 2E0B 0C2E 0E0F'X ||,           /* 0423 */
  424.          '1011 1213 1415 1617 1819 1A2E 1C1D 1E1F'X ||,           /* 0424 */
  425.          XRANGE('20'X, 'FE'X) || '.'                              /* 0425 */
  426.                                                                   /* 0426 */
  427.                                                                   /* 0427 */
  428. return                                                            /* 0428 */
  429.                                                                   /* 0429 */
  430. /*#-----------------------------------------------------------------------*/
  431. /*                                                                        */
  432. /*               Build Work File 02 From Directory Entries                */
  433. /*                                                                        */
  434. /*------------------------------------------------------------------------*/
  435. PROCESS_DRIVE:                                                    /* 0435 */
  436.    Procedure expose,                                              /* 0436 */
  437.       SYS001 SYS002                                               /* 0437 */
  438.                                                                   /* 0438 */
  439. drive = ARG(1)                                                    /* 0439 */
  440. notready_switch = ''                                              /* 0440 */
  441. call ON NOTREADY name DRIVE_NOTREADY                              /* 0441 */
  442. call STREAM drive || '*', 'D'       /* check for not ready */     /* 0442 */
  443. call OFF NOTREADY                                                 /* 0443 */
  444. if notready_switch <> '' then                                     /* 0444 */
  445.    do                                                             /* 0445 */
  446.       say '   Drive ' ||,                                         /* 0446 */
  447.           drive ||,                                               /* 0447 */
  448.           ' is not ready and is being ignored.'                   /* 0448 */
  449.       return                                                      /* 0449 */
  450.    end                                                            /* 0450 */
  451.                                                                   /* 0451 */
  452. if DOSFILESYS(drive) = 'CDFS' then return /* ignore CDROM drives */
  453.                                                                   /* 0453 */
  454. say '   Reading drive' drive                                      /* 0454 */
  455. '@dir' drive || '\*.* /s /n /o:n 1>' SYS001                       /* 0455 */
  456.                                                                   /* 0456 */
  457. do while LINES(SYS001) > 0                                        /* 0457 */
  458.    directory_line = LINEIN(SYS001)                                /* 0458 */
  459.    if LEFT( directory_line, 13 ) = ' Directory of' then           /* 0459 */
  460.       do                                                          /* 0460 */
  461.          parse value directory_line with . 15 path_name           /* 0461 */
  462.          if SUBSTR( path_name, LENGTH(path_name), 1 ) <> '\' then /* 0462 */
  463.             path_name = path_name || '\'                          /* 0463 */
  464.          iterate                                                  /* 0464 */
  465.       end                                                         /* 0465 */
  466.    if ( SUBSTR( directory_line, 3, 1 ) <> '-' )  |,               /* 0466 */
  467.       ( SUBSTR( directory_line, 6, 1 ) <> '-' ) then iterate      /* 0467 */
  468.    parse var directory_line,                                      /* 0468 */
  469.               file_date,                                          /* 0469 */
  470.               file_time,                                          /* 0470 */
  471.               file_size,                                          /* 0471 */
  472.               file_ea_size,                                       /* 0472 */
  473.               file_name                                           /* 0473 */
  474.    if file_ea_size = 0 then iterate                               /* 0474 */
  475.    if ( file_name = '.' )  |,                                     /* 0475 */
  476.       ( file_name = '..' ) then iterate                           /* 0476 */
  477.    full_file_name = path_name ||,                                 /* 0477 */
  478.                     STRIP(file_name)                              /* 0478 */
  479.    output_line = LEFT( file_size, 9 ) ||,                         /* 0479 */
  480.                  full_file_name                                   /* 0480 */
  481.    call LINEOUT SYS002, output_line                               /* 0481 */
  482. end                                                               /* 0482 */
  483. call STREAM SYS001, 'C', 'CLOSE'                                  /* 0483 */
  484. call SysFileDelete SYS001                                         /* 0484 */
  485. return                                                            /* 0485 */
  486.                                                                   /* 0486 */
  487. DRIVE_NOTREADY:                                                   /* 0487 */
  488.    Procedure expose notready_switch                               /* 0488 */
  489. notready_switch = 1                                               /* 0489 */
  490. return                                                            /* 0490 */
  491.                                                                   /* 0491 */
  492. /*#-----------------------------------------------------------------------*/
  493. /*                                                                        */
  494. /*                  Register external function routines                   */
  495. /*                                                                        */
  496. /*------------------------------------------------------------------------*/
  497. REGISTER_REQUIRED_FUNCTIONS:                                      /* 0497 */
  498.    Procedure expose REXX_Version                                  /* 0498 */
  499.                                                                   /* 0499 */
  500. /*----------------------------------------*/                      /* 0500 */
  501. /* Load REXXUtil External Function Module */                      /* 0501 */
  502. /*----------------------------------------*/                      /* 0502 */
  503. function_name      = 'SysLoadFuncs'                               /* 0503 */
  504. entry_name         = 'SysLoadFuncs'                               /* 0504 */
  505. module             = 'RexxUtil'                                   /* 0505 */
  506. anticipated_return = ''                                           /* 0506 */
  507. call REGISTER_ROUTINE function_name module entry_name anticipated_return
  508.                                                                   /* 0508 */
  509. /*-----------------------------------*/                           /* 0509 */
  510. /* Load the REXXLIB Function Package */                           /* 0510 */
  511. /*-----------------------------------*/                           /* 0511 */
  512. if REXX_Version = 'REXX/Personal' then                            /* 0512 */
  513.    do                                                             /* 0513 */
  514.       module = 'qrexxlib'                                         /* 0514 */
  515.    end                                                            /* 0515 */
  516. else                                                              /* 0516 */
  517.    do                                                             /* 0517 */
  518.       module = 'rexxlib'                                          /* 0518 */
  519.    end                                                            /* 0519 */
  520. entry_name         = 'RexxLibRegister'                            /* 0520 */
  521. function_name      = 'RexxLibRegister'                            /* 0521 */
  522. anticipated_return = '1'                                          /* 0522 */
  523. call REGISTER_ROUTINE function_name module entry_name anticipated_return
  524. return                                                            /* 0524 */
  525.                                                                   /* 0525 */
  526.                                                                   /* 0526 */
  527. REGISTER_ROUTINE:                                                 /* 0527 */
  528. parse ARG  function_name,                                         /* 0528 */
  529.            module,                                                /* 0529 */
  530.            entry_name,                                            /* 0530 */
  531.            anticipated_return                                     /* 0531 */
  532.                                                                   /* 0532 */
  533. if RxFuncQuery(function_name) = 0 then return      /* function registered */
  534.                                                                   /* 0534 */
  535. if LENGTH(module) > 8 then                                        /* 0535 */
  536.    do                                                             /* 0536 */
  537.       dll_drive = FILESPEC( 'D', module )                         /* 0537 */
  538.       dll_path  = STRIP( FILESPEC( 'P', module ), 'T', '\' )      /* 0538 */
  539.       module    = FILESPEC( 'N', module )                         /* 0539 */
  540.       '@' || dll_drive                                            /* 0540 */
  541.       '@cd' dll_drive || dll_path                                 /* 0541 */
  542.    end                                                            /* 0542 */
  543. else                                                              /* 0543 */
  544.    do                                                             /* 0544 */
  545.       dll_drive = ''                                              /* 0545 */
  546.    end                                                            /* 0546 */
  547.                                                                   /* 0547 */
  548. parse var module module_fname '.' module_fext                     /* 0548 */
  549. if RxFuncAdd( function_name, module_fname, entry_name ) = 0 then  /* 0549 */
  550.    do                                                             /* 0550 */
  551.       register_call = 'call' function_name                        /* 0551 */
  552.       interpret register_call                                     /* 0552 */
  553.       if WORD( RESULT, 1 ) <> WORD( anticipated_return, 1 ) then  /* 0553 */
  554.          do                                                       /* 0554 */
  555.             Say function_name 'returned' RESULT '-',              /* 0555 */
  556.                                          anticipated_return 'was expected'
  557.             exit 255                                              /* 0557 */
  558.          end                                                      /* 0558 */
  559.    end                                                            /* 0559 */
  560. else                                                              /* 0560 */
  561.    do                                                             /* 0561 */
  562.       Say 'RxFuncAdd returned' RESULT 'registering' module        /* 0562 */
  563.       exit 254                                                    /* 0563 */
  564.    end                                                            /* 0564 */
  565. if dll_drive <> '' then                                           /* 0565 */
  566.    do                                                             /* 0566 */
  567.       '@' || LEFT( program_path_and_name, 2 )                     /* 0567 */
  568.    end                                                            /* 0568 */
  569. return                                                            /* 0569 */
  570.                                                                   /* 0570 */
  571. /*#-----------------------------------------------------------------------*/
  572. /*                                                                        */
  573. /*                             Trap Routines                              */
  574. /*                                                                        */
  575. /*------------------------------------------------------------------------*/
  576. ERROR:   call TRAP_PROCESSING SIGL, 'ERROR',   RC                 /* 0576 */
  577. FAILURE: call TRAP_PROCESSING SIGL, 'FAILURE', RC                 /* 0577 */
  578. HALT:    call TRAP_PROCESSING SIGL, 'HALT',    ''                 /* 0578 */
  579. NOVALUE: call TRAP_PROCESSING SIGL, 'NOVALUE', ''                 /* 0579 */
  580. SYNTAX:  call TRAP_PROCESSING SIGL, 'SYNTAX',  RC                 /* 0580 */
  581.                                                                   /* 0581 */
  582. TRAP_PROCESSING:                                                  /* 0582 */
  583.    parse Source . . trap_path                                     /* 0583 */
  584.    trap_file_name = LEFT( trap_path, LENGTH(trap_path) - 3 ) ||,  /* 0584 */
  585.                     'DMP'                                         /* 0585 */
  586.    call SysFileDelete trap_file_name                              /* 0586 */
  587.                                                                   /* 0587 */
  588.    dbl_h    = '═'                   /* double line - horizontal   */
  589.    dbl_v    = '║'                   /* double line - vertical     */
  590.    dbl_bl   = '╚'                   /* double line - bottom left  */
  591.    dbl_br   = '╝'                   /* double line - bottom right */
  592.    dbl_tl   = '╔'                   /* double line - top left     */
  593.    dbl_tr   = '╗'                   /* double line - top right    */
  594.    say ' '                                                        /* 0594 */
  595.    trap_error_description = 'Tracing begun because of ' ||,       /* 0595 */
  596.                             ARG(2) ||,                            /* 0596 */
  597.                             ',  error line = ' || ARG(1)          /* 0597 */
  598.    if ARG(3) <> '' then                                           /* 0598 */
  599.       trap_error_description = trap_error_description ||,         /* 0599 */
  600.                                ',  return_code = ' || ARG(3)      /* 0600 */
  601.    say dbl_tl || COPIES( dbl_h, LENGTH(trap_error_description) + 2 ) || dbl_tr
  602.    say dbl_v  || COPIES( ' ',   LENGTH(trap_error_description) + 2 ) || dbl_v
  603.    say dbl_v               trap_error_description                       dbl_v
  604.    say dbl_v  || COPIES( ' ',   LENGTH(trap_error_description) + 2 ) || dbl_v
  605.    say dbl_v     CENTER( 'See: ' || trap_file_name,,              /* 0605 */
  606.                                       LENGTH(trap_error_description) )  dbl_v
  607.    say dbl_v  || COPIES( ' ',   LENGTH(trap_error_description) + 2 ) || dbl_v
  608.    say dbl_bl || COPIES( dbl_h, LENGTH(trap_error_description) + 2 ) || dbl_br
  609.    say ' '                                                        /* 0609 */
  610.    say 'Source line at time of trap:'                             /* 0610 */
  611.    say SOURCELINE(ARG(1))                                         /* 0611 */
  612.    say ' '                                                        /* 0612 */
  613.    call VARDUMP trap_file_name  /* write variables to program.DMP file */
  614.    trace ?r; nop                                                  /* 0614 */
  615.    exit -255                                                      /* 0615 */
  616.                                                                   /* 0616 */
  617. /*------------------------------------------------------------------------*/
  618. /*                                                                        */
  619. /*                  Write output line & tally line count                  */
  620. /*                                                                        */
  621. /*------------------------------------------------------------------------*/
  622. WRITE_OUTPUT_FILE:                                                /* 0622 */
  623.    Procedure expose,                                              /* 0623 */
  624.       program_name,                                               /* 0624 */
  625.       output_file,                                                /* 0625 */
  626.       output_file_line_count,                                     /* 0626 */
  627.       SYS001 SYS002                                               /* 0627 */
  628.                                                                   /* 0628 */
  629. output_file_line_count = output_file_line_count + 1               /* 0629 */
  630. call LINEOUT output_file, ARG(1)                                  /* 0630 */
  631. if RESULT <> 0 then                                               /* 0631 */
  632.    do                                                             /* 0632 */
  633.       call LINEOUT 'CON:', '0D0A'x ||,                            /* 0633 */
  634.          'Error writing line number ' ||,                         /* 0634 */
  635.          output_file_line_count ||,                               /* 0635 */
  636.          ' to ' ||,                                               /* 0636 */
  637.          output_file || '.'                                       /* 0637 */
  638.       call LINEOUT 'CON:',,                                       /* 0638 */
  639.          'Possibly insufficient disk space.'                      /* 0639 */
  640.       call LINEOUT 'CON:',,                                       /* 0640 */
  641.          'Work files - ' ||,                                      /* 0641 */
  642.          SYS001 || ' & ' || SYS002 ||,                            /* 0642 */
  643.          ' not erased.'                                           /* 0643 */
  644.       call EOJ 255                                                /* 0644 */
  645.    end                                                            /* 0645 */
  646. return                                                            /* 0646 */
  647. /*#********  REXX Cross Reference  - Created: 01/30/94 11:57pm ***********
  648.         F:\REXXPROG\LISTEA.CMD - Directory time stamp 1/30/94 11:43p
  649.  
  650. ---- VARIABLES ----
  651. !signal_value       0063<
  652. !tr!                0178<  0178   0178
  653. ?r                  0614
  654. Calling_Environment
  655.                     0049
  656. DRIVE_NOTREADY      0441
  657. OS_Environment      0050<
  658. OS_Name             0049
  659. RC                  0576   0577   0580
  660. RESULT              0553   0555   0562   0631
  661. REXX_Version        0048   0498   0512
  662. SIGL                0576   0577   0578   0579   0580
  663. SYS001              0082<  0173   0219   0322   0437   0455   0457   0458
  664.                     0483   0484   0627   0642
  665. SYS002              0083<  0097   0101   0110   0112   0117   0174   0219
  666.                     0322   0437   0481   0627   0642
  667. Version             0048
  668. X                   0422   0422   0423   0424   0425   0425
  669. anticipated_return  0506<  0507   0522<  0523   0531   0553   0556
  670. bksp                0126<  0131   0137
  671. byte_count          0340<  0341
  672. contig_hex_tt       0217   0320   0338   0379   0416<
  673. crlf                0224<  0260   0268
  674. dbl_bl              0590<  0608
  675. dbl_br              0591<  0608
  676. dbl_h               0588<  0601   0608
  677. dbl_tl              0592<  0601
  678. dbl_tr              0593<  0601
  679. dbl_v               0589<  0602   0602   0603   0603   0604   0604   0605
  680.                     0606   0607   0607
  681. directory_line      0458<  0459   0461   0466   0467   0468
  682. dll_drive           0537<  0540   0541   0545<  0565
  683. dll_path            0538<  0541
  684. drive               0439<  0442   0447   0452   0454   0455
  685. drive_table         0098   0099   0380   0390<  0396
  686. duration            0199<  0201
  687. e                   0109<  0111<  0111   0119   0129   0291<  0292
  688. ea_count            0226<  0227   0230
  689. ea_data             0325<  0330   0331   0331
  690. ea_example          0162   0168
  691. ea_hex_value        0162   0164
  692. ea_max_length       0089<  0212   0298   0299<
  693. ea_name             0162   0163
  694. ea_table.           0213   0381   0391<
  695. ea_table.0          0160   0161   0291   0292<  0391<
  696. ea_table.e          0293<
  697. ea_table.ea_name    0166
  698. ea_table.i          0162
  699. ea_table.name       0289   0297<  0303<  0303
  700. elapsed_time        0056<  0191<  0192
  701. entry_name          0504<  0507   0520<  0523   0530   0549
  702. eoj_rc              0188<  0190<  0202
  703. file_date           0469
  704. file_ea_size        0472   0474
  705. file_name           0222   0223<  0223   0226   0231   0243   0296   0473
  706.                     0475   0476   0478
  707. file_size           0222   0244   0471   0479
  708. file_table.         0107<
  709. file_table.0        0119<  0120   0129
  710. file_table.e        0113<  0130
  711. file_table_max_length
  712.                     0108<  0114<  0114   0121
  713. file_time           0470
  714. flag_stem.i         0273
  715. free_space          0072<  0073
  716. full_file_name      0477<  0480
  717. function_name       0503<  0507   0521<  0523   0528   0533   0549   0551
  718.                     0555
  719. heading.            0382
  720. heading.1           0397<  0408
  721. heading.2           0142   0404<
  722. hex_displacement    0326<  0343   0358   0367<  0367
  723. hex_tt              0383   0410<  0411<  0411   0412<  0412   0413<  0413
  724. hh                  0198<  0199
  725. i                   0161   0237   0257
  726. input_line          0112<  0113   0115
  727. leading_token       0331   0333   0339   0340
  728. list_name_only      0249<  0253<  0256   0281
  729. micro_seconds       0192   0193
  730. minutes             0196<  0197   0198
  731. mm                  0197<  0198   0199
  732. module              0505<  0507   0514<  0518<  0523   0529   0535   0537
  733.                     0538   0539<  0539   0548   0562
  734. module_fext         0548
  735. module_fname        0548   0549
  736. name                0238<  0250   0251   0293   0298   0299   0441
  737. name_stem.0         0237
  738. name_stem.i         0238   0275
  739. notready_switch     0440<  0444   0488   0489<
  740. output_disk         0069<  0072   0077
  741. output_file         0068<  0069   0070   0124   0142   0149   0158   0171
  742.                     0215   0233   0317   0385   0408   0625   0630   0637
  743. output_file_line_count
  744.                     0071<  0216   0259   0267   0318   0626   0629<  0629
  745.                     0635
  746. output_line         0145<  0149   0151<  0158   0163<  0169   0243<  0246<
  747.                     0246   0260<  0260   0261   0268<  0268   0269   0272<
  748.                     0279   0342<  0351   0357<  0363   0479<  0481
  749. output_width        0392<  0406
  750. path_name           0461   0462   0462   0463<  0463   0477
  751. prev_character_string
  752.                     0327<  0334   0368<
  753. program_name        0051<  0053   0055   0185   0200   0214   0319   0384
  754.                     0624
  755. program_path        0052<  0068   0082   0083
  756. program_path_and_name
  757.                     0049   0051   0052   0052   0567
  758. program_version     0054<
  759. progress_list       0127<  0132   0134
  760. progress_subscript  0128<  0132   0133<  0133   0134   0135<
  761. register_call       0551<  0552
  762. sameness_switch     0328<  0352<  0355   0364<
  763. seconds             0192   0194<  0194   0195   0196
  764. spread_hex_tt       0218   0321   0336   0386   0417<
  765. ss                  0195<  0196   0199
  766. temp_character_string
  767.                     0333<  0334   0337   0350   0368
  768. temp_hex_length     0341<  0346   0347
  769. temp_hex_string     0336<  0346
  770. title               0394<  0402
  771. trap_error_description
  772.                     0595<  0599<  0599   0601   0602   0603   0604   0606
  773.                     0607   0608
  774. trap_file_name      0584<  0586   0605   0613
  775. trap_path           0583   0584   0584
  776. tt_128              0220   0323   0350   0387   0422<
  777. tt_256              0388   0423<
  778. value_stem.i        0277   0283   0294   0295
  779. w                   0098   0099
  780. with                0162   0192   0331   0461
  781. word_count          0339<  0340   0341
  782. x                   0126   0143   0224   0229   0405   0408   0410   0411
  783.                     0411   0412   0412   0413   0413   0416   0416   0417
  784.                     0417   0417   0418   0418   0418   0419   0419   0419
  785.                     0420   0420   0633
  786.  
  787. ---- LABELS ----
  788. DRIVE_NOTREADY      0487:
  789. EOJ                 0176   0184:  0644
  790. ERROR               0059   0576:
  791. FAILURE             0577:
  792. FORMAT_EA_DETAIL    0283   0315:
  793. FORMAT_EA_ITEM      0130   0210:
  794. HALT                0578:
  795. INITIALIZE          0088   0377:
  796. NOVALUE             0061   0579:
  797. OFF                 0443
  798. ON                  0441
  799. PROCESS_DRIVE       0099   0435:
  800. PROCESS_SYS002      0106:
  801. REGISTER_REQUIRED_FUNCTIONS
  802.                     0057   0497:
  803. REGISTER_ROUTINE    0507   0523   0527:
  804. SYNTAX              0062   0580:
  805. TRAP_PROCESSING     0576   0577   0578   0579   0580   0582:
  806. WRITE_OUTPUT_FILE   0169   0261   0269   0279   0351   0363   0622:
  807.  
  808. ---- FUNCTIONS ----
  809. ARG                 0187   0190   0325   0439   0596   0597   0598   0600
  810.                     0611   0630
  811. ARRAYSORT           0120   0160
  812. C2X                 0164   0273   0337
  813. CENTER              0406   0605
  814. CHAROUT             0123   0131
  815. COPIES              0125   0151   0152   0153   0154   0155   0156   0157
  816.                     0165   0167   0272   0342   0344   0347   0349   0357
  817.                     0359   0399   0401   0410   0422   0422   0601   0602
  818.                     0604   0607   0608
  819. D2X                 0277   0343   0358
  820. DATE                0398
  821. DOSDISK             0072
  822. DOSEALIST           0226
  823. DOSFILESYS          0452
  824. FILESPEC            0069   0233   0537   0538   0539
  825. FORMAT              0166   0195   0197   0198
  826. FileSpec            0051
  827. LEFT                0052   0145   0146   0147   0163   0250   0273   0275
  828.                     0333   0346   0361   0459   0479   0567   0584
  829. LENGTH              0052   0053   0115   0134   0277   0298   0299   0339
  830.                     0340   0462   0535   0584   0601   0602   0604   0606
  831.                     0607   0608
  832. LINEIN              0112   0458
  833. LINEOUT             0075   0078   0137   0142   0149   0158   0408   0481
  834.                     0630   0633   0638   0640
  835. LINES               0110   0457
  836. MAX                 0114
  837. OVERLAY             0411   0412   0413
  838. RxFuncAdd           0549
  839. RxFuncQuery         0533
  840. SOURCELINE          0611
  841. STREAM              0101   0117   0171   0442   0483
  842. STRIP               0223   0238   0396   0478   0538
  843. SUBSTR              0132   0193   0294   0295   0462   0466   0467
  844. SysDriveMap         0390
  845. SysFileDelete       0070   0097   0173   0174   0484   0586
  846. TIME                0055   0056   0191   0200   0400
  847. TRACE               0178
  848. TRANSLATE           0201   0336   0350
  849. UPPER               0077
  850. VALUE               0178
  851. VARDUMP             0613
  852. WORD                0099   0115   0553   0553
  853. WORDS               0098
  854. X2D                 0411   0412   0413
  855. XRANGE              0411   0412   0413   0416   0417   0418   0419   0420
  856.                     0422   0425
  857.  
  858. *********************  End of REXX Cross Reference  *********************/
  859.